home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / Miro_Downloader.exe / theme.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2007-11-12  |  2.6 KB  |  71 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. import config
  5. import prefs
  6. import app
  7. import views
  8. import indexes
  9. import os
  10. from eventloop import asUrgent
  11. from database import DDBObject
  12. import opml
  13. import iconcache
  14. import guide
  15.  
  16. class ThemeHistory(DDBObject):
  17.     
  18.     def __init__(self):
  19.         DDBObject.__init__(self)
  20.         self.lastTheme = None
  21.         self.pastThemes = []
  22.         self.theme = unicode(config.get(prefs.THEME_NAME))
  23.         if self.theme is not None:
  24.             self.pastThemes.append(self.theme)
  25.             self.onFirstRun()
  26.         
  27.  
  28.     
  29.     def onRestore(self):
  30.         self.theme = unicode(config.get(prefs.THEME_NAME))
  31.         if not self.theme is None or self.theme in self.pastThemes:
  32.             self.pastThemes.append(self.theme)
  33.             self.onFirstRun()
  34.         
  35.         if self.lastTheme != self.theme:
  36.             self.onThemeChange()
  37.             self.lastTheme = self.theme
  38.         
  39.  
  40.     
  41.     def onThemeChange(self):
  42.         if len(views.default_guide) > 0:
  43.             views.default_guide[0].title = None
  44.             views.default_guide[0].favicon = None
  45.             views.default_guide[0].updated_url = None
  46.             views.default_guide[0].iconCache.remove()
  47.             views.default_guide[0].iconCache = iconcache.IconCache(views.default_guide[0], is_vital = True)
  48.             views.default_guide[0].signalChange()
  49.         
  50.         self.signalChange()
  51.  
  52.     onThemeChange = asUrgent(onThemeChange)
  53.     
  54.     def onFirstRun(self):
  55.         if config.get(prefs.MAXIMIZE_ON_FIRST_RUN).lower() not in ('false', 'no', '0'):
  56.             app.delegate.maximizeWindow()
  57.         
  58.         if config.get(prefs.DEFAULT_CHANNELS_FILE) is not None and config.get(prefs.THEME_NAME) is not None and config.get(prefs.THEME_DIRECTORY) is not None:
  59.             importer = opml.Importer()
  60.             filepath = os.path.join(config.get(prefs.THEME_DIRECTORY), config.get(prefs.THEME_NAME), config.get(prefs.DEFAULT_CHANNELS_FILE))
  61.             importer.importSubscriptionsFrom(filepath, showSummary = False)
  62.         
  63.         for temp_guide in unicode(config.get(prefs.ADDITIONAL_CHANNEL_GUIDES)).split():
  64.             if views.guides.getItemWithIndex(indexes.guidesByURL, temp_guide) is None:
  65.                 guide.ChannelGuide(temp_guide)
  66.                 continue
  67.         
  68.  
  69.     onFirstRun = asUrgent(onFirstRun)
  70.  
  71.